/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. A copy of the
 * WTFPL version 2 is provided in the source archive, at
 * example/WTFPL-2 .*/
#include <fake437.h>

int main(int argc, char* argv[]) {
  SDL_Surface* screen;
  SDL_Event ev;
  int x;
  int y;
  int done = 0;
  const F437Font* font = f437_get_font(F437_FONT_8x14);
  const SDL_Color* fg = f437_get_color(F437_COLOR_BWHITE);
  const SDL_Color* bg = f437_get_color(F437_COLOR_BLACK);
  (void)argc;
  (void)argv;
  SDL_Init(SDL_INIT_VIDEO);

  screen = SDL_SetVideoMode(F437_DEFAULT_WIDTH * font->char_width,
                            F437_DEFAULT_HEIGHT * font->char_height, 0, 0);
  for (y = 0; y < 16; y++) {
    for (x = 0; x < 16; x++) {
      f437_putc(screen, font,
                x * font->char_width, y * font->char_height, 1,
                y*16+x, fg, bg);
    }
  }

  SDL_Flip(screen);
  while (!done) {
    while (SDL_PollEvent(&ev)) {
      if ((ev.type == SDL_KEYDOWN) &&
          (ev.key.keysym.sym == SDLK_ESCAPE)) done = 1;
    }
  }

  SDL_Quit();
  return 0;
}
